package com.jisu.controller;


import com.jisu.common.ResultVo;
import com.jisu.pojo.Specs;
import com.jisu.service.SpecsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RefreshScope
public class SpecsController {

    @Autowired
    private SpecsService specsService;
    @GetMapping("/searchByModelId")
    public ResultVo<List<Specs>> getVehiclesByModelId(@RequestParam String modelId) {
        try {
             List<Specs> Specs = specsService.findByModelId(modelId);

            return ResultVo.success("查询成功", Specs);
        } catch (Exception e) {
            e.printStackTrace();
            return ResultVo.fail("查询失败", e);
        }
    }
}
